package com.example.demo.controller;

import com.example.demo.entity.Result;
import com.example.demo.exception.DefinitionException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName ExController
 * @Author bsy
 * @Description 测试全局异常：
 *  自定义异常
 *  其他业务异常
 * @Date 2022/8/15 22:43
 * @Version 1.0
 */
@RestController
public class ExController {

    @RequestMapping("/getDeException")
    public Result DeException(){
        throw new DefinitionException(400,"我出错了");
    }

    @RequestMapping("/getBusiException")
    public Result Exception(){
        Result result = new Result();
        int a=1/0;
        return result;
    }
}
